package com.springboot.myspringboot.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.springboot.myspringboot.entity.AreaCount;
import com.springboot.myspringboot.entity.SolidTable;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface SolidTableMapper extends BaseMapper<SolidTable> {

    @Select("select * from solid_table")
    List<SolidTable> findAll();

    @Select("select * from solid_table where area_id = #{area_id}")
    List<SolidTable> findAllByAreaId(@Param("area_id") Integer id);

    @Select("select area_name as name, COUNT(*) as count from solid_table GROUP BY area_name")
    List<AreaCount> findAreaCount();

}
